from django.db import models


# Create your models here.
class ClsModel(models.Model):
    name = models.CharField(max_length=10)

    def __str__(self):
        return self.name

    class Meta():
        db_table = 'cls'


class StudentModel(models.Model):
    GENDER_CHOICES = {
        (1, '男'),
        (2, '女'),
        (3, '保密'),
    }
    name = models.CharField(max_length=10)
    age = models.IntegerField()
    gender = models.IntegerField(choices=GENDER_CHOICES)
    height = models.DecimalField(max_digits=3, decimal_places=2)
    cls = models.ForeignKey(ClsModel, on_delete=models.SET_NULL, null=True)

    def __str__(self):
        return self.name

    class Meta():
        db_table = 'student'
